{include file="public/header" /}
<link href="{$Think.ADMIN_SITE_ROOT}/select2/select2.css" rel="stylesheet"/>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/select2/select2.full.min.js"></script>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/select2/zh-CN.js"></script>
<div class="page">
        <form id="form" method="post" name="form1">
            <input type="hidden" name="id" value="{$array.id}" id="id"/>
            <table class="ds-default-table">
                <tbody>
                <tr class="noborder">
                    <td class="required w120"><label class="validation">昵称:</label></td>
                    <td class="vatop rowform"><input type="text" value="{$array.name}" name="name" id="name" class="txt"></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label class="validation">{$Think.lang.storework_index_storeid}:</label></td>
                    <td class="vatop rowform">
                        <select name="storeid" id="storeid"  class="show-tick form-control">
                            <option value="">--请选择</option>
                            {foreach name="storeArr" item="v"}
                            <option value="{$v.store_id}" {if $array.storeid == $v.store_id} selected {/if}>{$v.store_name}</option>
                            {/foreach}
                        </select>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label class="validation">{$Think.lang.storework_index_account}:</label></td>
                    <td class="vatop rowform"><input readonly type="text" value="{$array.account}" name="account" id="account" class="txt"></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label class="validation">{$Think.lang.storework_index_password}:</label></td>
                    <td class="vatop rowform"><input type="password" value="" name="password" id="password" class="txt"></td>
                    <td class="vatop tips">{if $array.id}{$Think.lang.storework_index_password_tip}{/if}</td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label class="validation">{$Think.lang.storework_index_password_two}:</label></td>
                    <td class="vatop rowform"><input type="password" value="" name="queren_password" id="queren_password" class="txt"></td>
                    <td class="vatop tips">{if $array.id}{$Think.lang.storework_index_password_tip}{/if}</td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label class="validation">{$Think.lang.storework_index_truename}:</label></td>
                    <td class="vatop rowform"><input type="text" value="{$array.truename}" name="truename" id="truename" class="txt"></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label class="validation">{$Think.lang.storework_index_idcard}:</label></td>
                    <td class="vatop rowform"><input type="text" value="{$array.idcard}" name="idcard" id="idcard" class="txt"></td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label class="validation">{$Think.lang.storework_index_sex}:</label></td>
                    <td class="vatop rowform">
                        <input type="radio" value="0" name="sex" {if $array.sex == 0}checked {/if}>{$Think.lang.storework_index_sex_0}&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" value="1" name="sex" {if $array.sex == 1}checked {/if}>{$Think.lang.storework_index_sex_1}&nbsp;&nbsp;&nbsp;&nbsp;
                        <input type="radio" value="2" name="sex" {if $array.sex == 2}checked {/if}>{$Think.lang.storework_index_sex_2}&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.storework_index_status}: </label></td>
                    <td class="vatop rowform">
<!--                         onoff-->
                        <input type="radio" value="0" name="status" {if $array.status == 0}checked {/if}>
                        <label style="margin-right: 15px;">{$Think.lang.storework_add_status_daishenhe}</label>
                        <input type="radio" value="1" name="status" {if $array.status == 1}checked {/if}>
                        <label style="margin-right: 15px;">{$Think.lang.storework_add_status_on}</label>
                        <input type="radio" value="2" name="status" {if $array.status == 2}checked {/if}>
                        {$Think.lang.storework_add_status_off}
<!--                        <label for="status1" class="cb-enable {if $array.status == '1'}selected{/if}" title="{$Think.lang.storework_add_status_on}"><span>{$Think.lang.storework_add_status_on}</span></label>-->
<!--                        <label for="status2" class="cb-disable {if $array.status == '2'}selected{/if}" title="{$Think.lang.storework_add_status_off}"><span>{$Think.lang.storework_add_status_off}</span></label>-->
<!--                        <input id="status1" name="status" {if $array.status == '1'}checked="checked"{/if} value="1" type="radio">-->
<!--                        <input id="status2" name="status" {if $array.status == '2'}checked="checked"{/if} value="2" type="radio">-->
                    </td>
                    <td  class="vatop tips"></td>
                </tr>
                <tr class="noborder">
<!--                     class="validation"-->
                    <td class="required w120"><label>{$Think.lang.storework_add_fail_reason}:</label></td>
                    <td class="vatop rowform">
                        <input type="text" name="fail_reason" style="width: 260px;height: 55px;" value="{$array.fail_reason}"/>
                    </td>
                    <td class="vatop tips"></td>
                </tr>
                <tr class="noborder">
                    <td class="required w120"><label>{$Think.lang.storework_index_status2}: </label></td>
                    <td class="vatop rowform onoff">
                        <label for="status2" class="cb-enable {if $array.status2 == '1'}selected{/if}" title="{$Think.lang.storework_index_status_on}"><span>{$Think.lang.storework_index_status_on}</span></label>
                        <label for="status0" class="cb-disable {if $array.status2 == '0'}selected{/if}" title="{$Think.lang.storework_index_status_off}"><span>{$Think.lang.storework_index_status_off}</span></label>
                        <input id="status2" name="status2" {if $array.status2 == '1'}checked="checked"{/if} value="1" type="radio">
                        <input id="status0" name="status2" {if $array.status2 == '0'}checked="checked"{/if} value="0" type="radio">
                    </td>
                    <td  class="vatop tips"></td>
                </tr>
                </tbody>
                <tfoot>
                <tr class="tfoot">
                    <td colspan="15" ><input class="btn" type="submit" value="{$Think.lang.ds_submit}"/></td>
                </tr>
                </tfoot>
            </table>
        </form>
    </div>
<script src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js"></script>
<script>
//按钮先执行验证再提交表
    $(document).ready(function () {
        $("#storeid").select2();
        $.extend($.validator.defaults,{ignore:""});
        $("#storeid").change(function(){
            $(this).valid();
        });
        $("#form").validate({
            errorPlacement: function (error,element) {
                error.appendTo(element.parent().parent().find('td:last'));
            },
            rules:{
                name:{
                    required:true,
                    minlength:4,
                    maxlength:8,
                    remote:{
                        url:ADMINSITEURL+'/Storework/ajax.html?branch=check_work_name',
                        type:'get',
                        data:{
                            workname:function () {
                             return $('#name').val();
                            },
                            workid:function () {
                                return $('#id').val();
                            }
                        }
                    }
                },
                storeid:{
                    required:true,
                },
                account:{
                    required:true,
                    minlength:6,
                    // maxlength:8,
                    remote:{
                        url: ADMINSITEURL+'/Storework/ajax.html?branch=check_work_account',
                        type:'get',
                        data:{
                            workaccount:function () {
                                return $('#account').val();
                            },
                            workid:function () {
                                return $('#id').val();
                            }
                        }
                    }
                },
                password:{
                    // required:true,
                    minlength:6,
                    // maxlength:8,
                },
               queren_password:{
                    // required:true,
                    equalTo:"#password",
                },
                truename:{
                    required:true,
                    minlength:2,
                },
                idcard:{
                    required:true,
                    remote:{
                        url:ADMINSITEURL+'/Zhuwork/ajax_idcard.html',
                        type:'get',
                        data:{
                            idcard:function () {
                                return $('#idcard').val();
                            },
                        }
                    }
                },

            },
            messages:{
                name:{
                    required:'{$Think.lang.storework_add_name_required}',
                    minlength:'{$Think.lang.storework_add_name_length}',
                    maxlength:'{$Think.lang.storework_add_name_length}',
                    remote:'{$Think.lang.storework_add_name_validate_not_exists}',
                },
                storeid:{
                    required: '{$Think.lang.storework_add_storeid_required}',
                },
                account:{
                    required:'{$Think.lang.storework_add_account_required}',
                    minlength:'{$Think.lang.storework_add_account_length}',
                    maxlength:'{$Think.lang.storework_add_account_length}',
                    remote:'{$Think.lang.storework_add_account_validate_not_exists}'
                },
                password:{
                    required:'{$Think.lang.storework_add_password_required}',
                    minlength:'{$Think.lang.storework_add_password_length}',
                    maxlength:'{$Think.lang.storework_add_password_length}',
                },
                queren_password:{
                    required:'{$Think.lang.storework_add_queren_password_required}',
                    equalTo:'{$Think.lang.storework_add_queren_password_validate_repeat}',
                },
                truename:{
                    required:'{$Think.lang.storework_truename_required}',
                    minlength:'{$Think.lang.storework_truename_minlength}',
                },
                idcard:{
                    required:'{$Think.lang.storework_idcard_required}',
                    remote:'{$Think.lang.storework_idcard_reg}'
                }
            }
        });
    });
</script>